//
//  LGJoinProjectViewCell.m
//  HeartDisease_YHJK
//
//  Created by 1234 on 2025/10/27.
//  配置量表 -- Cell

#import "LGJoinProjectViewCell.h"

@interface LGJoinProjectViewCell()
/**   */
@property (nonatomic , strong)UIImageView *iconView;
/**   */
@property (nonatomic , strong)UILabel *contentLabel;

@end

@implementation LGJoinProjectViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self.contentView addSubview:self.iconView];
        [self.contentView addSubview:self.contentLabel];
        
        [self.iconView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(viewPix(42));
            make.width.height.equalTo(@(viewPix(18)));
            make.centerY.equalTo(self.contentView);
        }];
        [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.contentView).offset(viewPix(8));
            make.left.equalTo(self.iconView.mas_right).offset(viewPix(5));
            make.right.equalTo(self.contentView).offset(-viewPix(12));
            make.bottom.equalTo(self.contentView).offset(-viewPix(8));
        }];
        
    }
    return  self;
}

-(void)setDataDic:(NSDictionary *)dataDic{
    _dataDic = dataDic;
    self.contentLabel.text = LGNSString(dataDic[@"title"]);
    NSString *iconName = [LGNSString(dataDic[@"is_checked"]) isEqualToString:@"0"]?@"unselect24":@"selected24";
    self.iconView.image = [UIImage imageNamed:iconName];
}

-(void)setTitle:(NSString *)title{
    _title = title;
    self.contentLabel.text = title;
}

#pragma mark
#pragma mark ====> 创建控件

-(UIImageView *)iconView{
    if(!_iconView){
        _iconView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"unselect24"]];
    }
    return _iconView;
}

-(UILabel *)contentLabel{
    if(!_contentLabel){
        _contentLabel = [UILabel lableWithText:@"" colorString:@"#333333" textFont:LGFont(15) textAlignment:NSTextAlignmentLeft lines:0];
    }
    return _contentLabel;
}

@end
